package com.dapeis.web.wx.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.JsonElement;

public interface IOrderController {

	/**
	 * 更新订单，使用优惠券
	 * 
	 * @param requirementId
	 * @param couponsId
	 * @return
	 */
	@RequestMapping(value = "/updateCoupons", method = RequestMethod.POST)
	public @ResponseBody JsonElement updateCouponsOrder(@RequestParam Long orderId,
			@RequestParam(required = false) Integer couponsId,
			HttpServletRequest request);

	/**
	 * 使用优惠券查询订单信息
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/queryCoupons", method = RequestMethod.GET)
	public @ResponseBody JsonElement queryCouponsOrder(
			@RequestParam Long orderId, HttpServletRequest request);

	/**
	 * 根据Order进行预支付请求，并返回信息给JS
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getUnified", method = RequestMethod.POST)
	public @ResponseBody JsonElement getUnifiedInfo(@RequestParam Long orderId,
			HttpServletRequest request);

	/**
	 * 前端返回成功后,如果服务端未返回。则主动查询
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getPayResult", method = RequestMethod.POST)
	public @ResponseBody JsonElement getPayResult(@RequestParam Long orderId,
			HttpServletRequest request);

	/**
	 * 我的订单
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getMy")
	public @ResponseBody JsonElement getMyOrder(HttpServletRequest request);

	/**
	 * 订单详情
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/detail")
	public @ResponseBody JsonElement detail(@RequestParam Long orderId,
			HttpServletRequest request);

	/**
	 * 订单取消操作
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/canel", method = RequestMethod.POST)
	public @ResponseBody JsonElement canel(@RequestParam Long orderId,
			HttpServletRequest request);

	/**
	 * 订单退款
	 * 
	 * @param orderId
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/refund", method = RequestMethod.POST)
	public @ResponseBody JsonElement refund(@RequestParam Long orderId,
			HttpServletRequest request);

	
	/**
	 * 结束服务
	 * 
	 * @param orderId
	 * @return
	 */
	@RequestMapping(value = "/finish", method = RequestMethod.POST)
	public @ResponseBody JsonElement finishService(@RequestParam Long orderId);
}
